
package cn.bs.socket.server;

import java.net.DatagramPacket;
import java.net.InetAddress;

public class Dgram {
       public static DatagramPacket toDataGram(String str,InetAddress destIA,int destPort){
          byte[] buf = new byte[str.length()+1];
           return new DatagramPacket(buf,buf.length,destIA,destPort);
       }

    public static String toString(DatagramPacket p){

         return new String(p.getData(),0,p.getLength());
    }
}
